package com.frank.easyexcel.validate;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 小石潭记
 * @date 2020/10/22 14:54
 * @Description: ${todo}
 */
public class ExcelHeadValidate {

    /*private static final List<String> HEADER_RECORD = Arrays
            .asList("id", "姓名", "性别", "生日");*/

    private static final Map<String, String> HEADER_RECORD = new HashMap<String, String>() {
        {
            put("id", "General0");
            put("姓名", "General0");
            put("性别", "General0");
            put("生日", "General0");
        }
    };

    /**
     *  校验表头，
     * @param columnName 表头名字
     * @param columnConfig 表头列所对应的配置，
     *        cellData.getValue.getDataFormatString() + cellData.getValue().getDataFormat()
     * @return
     */
    public static boolean validateHeader(String columnName, String columnConfig) {
        if (!HEADER_RECORD.containsKey(columnName)) {
            return false;
        }
        // 因为我们的表格暂时未加校验
        if (!columnConfig.equals(HEADER_RECORD.get(columnName))) {
            return false;
        }
        return true;
    }


}
